# Table E1

#####
rm(list=ls(all=TRUE))

library(MASS)
library(stargazer)

#### Dataset Original ####
setwd("/Users/sebastian/Dropbox/The politics of interruptions - JOP RR/Replication Files/Data Rep")
load("data_empirics_rep.Rdata")

## By periods ----
data_empirics$pre_1998 <- ifelse(data_empirics$cohort == "1988-1990" |
                                   data_empirics$cohort == "1990-1992" | 
                                   data_empirics$cohort == "1992-1994" | 
                                   data_empirics$cohort == "1994-1996" |
                                   data_empirics$cohort == "1996-1998", 1, 0)

## MODEL 2.1 Original -----

model_2.1 <- glm(interruption_final_dummy ~ female_dum + ideology_ext + 
                   committee_chair + seniority + type_member +
                   party_match_pres + 
                   election_year +
                   tot_num_speeches_session_10 + mean_length_leg +
                   negative_lang_w + mujeres_dummy_before +
                   factor(cohort), 
                 data = data_empirics, family = "binomial")

model_2.2 <- glm(procedural_interruption_dummy ~ female_dum + ideology_ext + 
                   committee_chair + seniority + type_member +
                   party_match_pres + 
                   election_year  +
                   tot_num_speeches_session_10 + mean_length_leg +
                   negative_lang_w + mujeres_dummy_before + 
                   factor(cohort), 
                 data = data_empirics, family = "binomial")

model_2.3 <- glm(aggressive_interruption_dummy ~ female_dum + ideology_ext + 
                   committee_chair + seniority + type_member +
                   party_match_pres + 
                   election_year  +
                   tot_num_speeches_session_10 + mean_length_leg +
                   negative_lang_w + mujeres_dummy_before +
                   factor(cohort), 
                 data = data_empirics, family = "binomial")

#### Pre and post:------

model_2.1_pre1998 <- glm(interruption_final_dummy ~ female_dum + ideology_ext + 
                           committee_chair + seniority + type_member +
                           party_match_pres + 
                           election_year +
                           tot_num_speeches_session_10 + mean_length_leg +
                           negative_lang_w + mujeres_dummy_before +
                           factor(cohort), 
                         data = subset(data_empirics, data_empirics$pre_1998 ==1),
                         family = "binomial")

model_2.1_post1998pre2008 <- glm(interruption_final_dummy ~ female_dum + ideology_ext + 
                                   committee_chair + seniority + type_member +
                                   party_match_pres + 
                                   election_year +
                                   tot_num_speeches_session_10 + mean_length_leg +
                                   negative_lang_w + mujeres_dummy_before +
                                   factor(cohort), 
                                 data = subset(data_empirics, data_empirics$pre_1998 ==0 &
                                                 data_empirics$post_2008 ==0), 
                                 family = "binomial")

model_2.1_post2008 <- glm(interruption_final_dummy ~ female_dum + ideology_ext + 
                            committee_chair + seniority + type_member +
                            party_match_pres + 
                            election_year +
                            tot_num_speeches_session_10 + mean_length_leg +
                            negative_lang_w + mujeres_dummy_before +
                            factor(cohort), 
                          data = subset(data_empirics, data_empirics$post_2008 ==1),
                          family = "binomial")

### 

model_2.2_pre1998 <- glm(procedural_interruption_dummy ~ female_dum + ideology_ext + 
                           committee_chair + seniority + type_member +
                           party_match_pres + 
                           election_year +
                           tot_num_speeches_session_10 + mean_length_leg +
                           negative_lang_w + mujeres_dummy_before +
                           factor(cohort), 
                         data = subset(data_empirics, data_empirics$pre_1998 ==1),
                         family = "binomial")

model_2.2_post1998pre2008 <- glm(procedural_interruption_dummy ~ female_dum + ideology_ext + 
                                   committee_chair + seniority + type_member +
                                   party_match_pres + 
                                   election_year +
                                   tot_num_speeches_session_10 + mean_length_leg +
                                   negative_lang_w + mujeres_dummy_before +
                                   factor(cohort), 
                                 data = subset(data_empirics, data_empirics$pre_1998 ==0 &
                                                 data_empirics$post_2008 ==0), 
                                 family = "binomial")

model_2.2_post2008 <- glm(procedural_interruption_dummy ~ female_dum + ideology_ext + 
                            committee_chair + seniority + type_member +
                            party_match_pres + 
                            election_year +
                            tot_num_speeches_session_10 + mean_length_leg +
                            negative_lang_w + mujeres_dummy_before +
                            factor(cohort), 
                          data = subset(data_empirics, data_empirics$post_2008 ==1),
                          family = "binomial")

###

model_2.3_pre1998 <- glm(aggressive_interruption_dummy ~ female_dum + ideology_ext + 
                           committee_chair + seniority + type_member +
                           party_match_pres + 
                           election_year +
                           tot_num_speeches_session_10 + mean_length_leg +
                           negative_lang_w + mujeres_dummy_before +
                           factor(cohort), 
                         data = subset(data_empirics, data_empirics$pre_1998 ==1),
                         family = "binomial")

model_2.3_post1998pre2008 <- glm(aggressive_interruption_dummy ~ female_dum + ideology_ext + 
                                   committee_chair + seniority + type_member +
                                   party_match_pres + 
                                   election_year +
                                   tot_num_speeches_session_10 + mean_length_leg +
                                   negative_lang_w + mujeres_dummy_before +
                                   factor(cohort), 
                                 data = subset(data_empirics, data_empirics$pre_1998 ==0 &
                                                 data_empirics$post_2008 ==0), 
                                 family = "binomial")

model_2.3_post2008 <- glm(aggressive_interruption_dummy ~ female_dum + ideology_ext + 
                            committee_chair + seniority + type_member +
                            party_match_pres + 
                            election_year +
                            tot_num_speeches_session_10 + mean_length_leg +
                            negative_lang_w + mujeres_dummy_before +
                            factor(cohort), 
                          data = subset(data_empirics, data_empirics$post_2008 ==1),
                          family = "binomial")

#### TABLE E1: Determinants of Interruptions by Period -----
setwd("/Users/sebastian/Dropbox/The politics of interruptions - JOP RR/Replication Files/Table")

stargazer(model_2.1,model_2.2,model_2.3, 
          model_2.1_pre1998,model_2.2_pre1998,model_2.3_pre1998,
          model_2.1_post1998pre2008,model_2.2_post1998pre2008,model_2.3_post1998pre2008,
          model_2.1_post2008,model_2.2_post2008,model_2.3_post2008,
          type = "html", style = "ajps", out = "tableE1.html",
          covariate.labels = c("Woman","Ideological Extremism","Committee Chair",
                               "Seniority", "National MC", "Same Party as Leg. Pres.",
                               "Speeches during Debate",
                               "Mean Length of MC Speech",
                               "Election Year", "Negative Language (Speech)",
                               "Topic: Women"),
          omit = "factor",
          no.space=TRUE,
          dep.var.labels=c("Interruptions (All) Original","Procedural Interruptions Original", "Aggressive Interruptions Original",
                           "Interruptions (All) Pre 1998","Procedural Interruptions Pre 1998", "Aggressive Interruptions Pre 1998",
                           "Interruptions (All) Post 1998 pre 2007","Procedural Interruptions Post 1998 pre 2007", "Aggressive Interruptions Post 1998 pre 2007",
                           "Interruptions (All) Post 2009","Procedural Interruptions Post 2009", "Aggressive Interruptions Post 2009"),
          digits=3,
          df = FALSE,
          keep.stat = c("theta", "n"))
